package com.henme.crm.util.mybatis;

import com.henme.crm.util.page.Page;


public class Mssql12Dialect implements Dialect {

    @Override
    public String getLimitString(Page page, String sql) {
        // 这个offset 的值是否要加1要测试下
        int offset = (page.getPageNo() - 1) * page.getPageSize()+1;
        StringBuffer sqlBuffer = new StringBuffer(sql);
        sqlBuffer.append(" OFFSET " ).append(offset).append(" ROW FETCH NEXT ").append(page.getPageSize()).append(" ROWS ONLY ");
        return sqlBuffer.toString();
    }
}
